import request from '@/utils/request'

// 获取商品分类信息
export const getCategoryService = () => {
  return request.get('/product/getcategory')
}

// 发布商品信息
export const publishProductService = (data) => {
  return request.post('/product/publish', data)
}

// 根据分类ID获取商品列表
export const getProductListService = (categoryId) => {
  return request.get('/product/getbycategoryid', {
    params: {
      categoryId
    }
  })
}

// 根据定位获取商品列表
export const getProductListByLocationService = (province,city) => {
  return request.get('/product/getproductbylocation', {
    params: {
      province,
      city
    }
  })
}

// 根据商品id获取商品详情
export const getProductDetailService = (id) => {
  return request.get('/product/getproductdetail', {params: {id}})
}


// 修改商品信息
export const updateProductService = (data) => {
  return request.post('/product/updateproduct', data)
}

// 删除商品